<template>
	<view class="container" v-if="!$u.test.isEmpty(dataInfo)">

		<view class="address bg-fff" @click="selectAddress">
			<view class="flex-space-between">
				<view class="address-title">收货地址</view>
				<u-icon name="arrow-right" size="32rpx" color="#333"></u-icon>
			</view>

			<view class="address-info" v-if="!$u.test.isEmpty(address)">
				<view class="address-info-text">
					{{ address.region.province }}{{ address.region.city }}{{ address.region.region }}{{ address.detail }}{{ address.house_number }}
				</view>
				
				<template v-if="vuex_stall_id==0">
					<view class="address-info-user">{{ address.name }} {{ address.phone }}</view>
				</template>
			</view>
			
		</view>
		<view class="cell bg-fff" v-if="vuex_stall_id>0">
			<view class="cell-item flex-space-between">
				<view class=""><text class="text-red">*</text>收货人</view>
				<view class="flex-align-center">
					<input type="text" style="text-align: right;" v-model="real_name" placeholder="请输入桌号或您的尊称" />
				</view>
			</view>
			<view class="cell-item flex-space-between">
				<view class=""><text class="text-red">*</text>联系电话</view>
				<view class="flex-align-center">
					<input type="number" style="text-align: right;" v-model="real_phone" placeholder="请输入联系电话" />
				</view>
			</view>
		</view>

		<view class="address bg-fff flex-box bor-top" v-if="!checkbusiness">
			<view class="flex-space-between">
				<view class="address-title">预约配送</view>
			</view>
			<hTimePicker sTime="15" cTime="15" interval="1" @changeTime="changeTime" :timeNum="starttime_h"
				:mTime="starttime_i">
				<view slot="pCon" class="changeTime">
					{{ yypstime ? yypstime : '选择配送时间' }}
				</view>
			</hTimePicker>
		</view>

		<view class="product bg-fff">
			<view v-for="(item, index) in dataInfo.orderInfo.supplierList" :key="index">
				<view class="product-item flex" v-for="(it, idx) in item.productList" :key="idx">
					<image class="product-item-image" :src="it.product_image"></image>
					<view class="product-item-con flex-column-space-between">
						<view>
							<view class="product-item-name u-line-1">{{ it.product_name }}</view>
							<view class="product-item-suk">{{ it.product_sku.product_attr }}</view>
						</view>

						<view class="flex-space-between">
							<view class="product-item-num">x{{ it.total_num }}</view>
							<view class="product-item-price">￥{{ it.product_price }}</view>
						</view>
					</view>
				</view>
			</view>
			<view v-if="gift_product_data">
				<view class="product-item flex product-item-gift">
					<image style="width: 100rpx;height: 100rpx;" :src="gift_product_data.file.file_path"></image>
					<view class="product-item-con flex-column-space-between">
						<view>
							<view class="product-item-name u-line-1">{{ gift_product_data.product_name }}</view>
							<!-- <view class="product-item-suk">{{gift_product_data.file.real_name}}</view> -->
						</view>

						<view class="flex-space-between">
							<view class="product-item-num">x{{ gift_product_data.gift_num }}</view>
							<view class="product-item-price">赠品</view>
						</view>
					</view>
				</view>
			</view>

			<view class="product-total">合计：￥<text>{{ dataInfo.orderInfo.orderData.order_total_price }}</text></view>
		</view>

		<view class="pay flex-space-between bg-fff">
			<view>支付</view>
			<view>
				<text v-if="params.pay_source == 'wx'">微信支付</text>
			</view>
		</view>

		<view class="cell bg-fff">
			<!-- <view class="cell-item flex-space-between">
				<view class="">开具发票</view>
				<view>
					<view class=""></view>
					<u-icon name="arrow-right" size="28rpx" color="#333"></u-icon>
				</view>
			</view> -->
			<view class="cell-item flex-space-between">
				<view class="">留言备注</view>
				<view class="flex-align-center">
					<input type="text" style="text-align: right;" v-model="remark" />
					<u-icon name="arrow-right" size="28rpx" color="#333"></u-icon>
				</view>
			</view>
			<view class="cell-item flex-space-between" @click="couponShow = !couponShow"
				v-if="order_type != 'seckill' && order_type != 'assemble' && order_type != 'limited' && parseInt(dataInfo.orderInfo.orderData.order_total_price) > 0">
				<view class="">使用优惠券</view>
				<view class="flex-align-center">
					<view class="">
						<text v-if="!$u.test.isEmpty(dataInfo.orderInfo.orderData.coupon_money_sys)"
							style="color: #bb0024;">-￥{{ dataInfo.orderInfo.orderData.coupon_money_sys }}</text>
						<text v-else-if="couponList.length > 0">有{{ couponList.length || 0 }}张优惠券可用</text>
						<text v-else-if="couponList.length == 0">无可用优惠券</text>
					</view>
					<u-icon name="arrow-right" size="28rpx" color="#333"></u-icon>
				</view>
			</view>
		</view>
		
		<view class="warning-price" v-show="dataInfo.in_delivery">
			<view class="warning-txt">
				<text>再点</text>
				<text class="warning">{{dataInfo.need_delivery}}</text>
				<text>元 即可19分钟秒送达</text>
			</view>
		</view>
		<view class="settle flex-space-between" :style="dataInfo.in_delivery?'margin-top:0px':''">
			<view class="flex-align-center">
				<button class="u-reset-button" @click="$store.dispatch('getCustomer')">
					<view class="flex-column-center">
						<image class="settle-image" :src="$setting.imageUrl() + 'kefu2.png'"></image>
						<view>客服</view>
					</view>
				</button>

				<view class="settle-total">合计：￥<text>{{ dataInfo.orderInfo.orderData.order_pay_price }}</text></view>
			</view>
			<template v-if="!dataInfo.in_delivery">
				<b-u-button-theme width="208rpx" height="112rpx" size="28rpx" @click="send(0)" v-if="checkbusiness">提交订单</b-u-button-theme>
				<b-u-button-theme width="230rpx" height="112rpx" size="28rpx" @click="send(1)" v-else>提交预约订单</b-u-button-theme>
			</template>
			<template v-else>
				<b-u-button-grey width="280rpx" height="112rpx" size="28rpx">差 {{dataInfo.need_delivery}} 元可送</b-u-button-grey>
			</template>
		</view>

		<safe-area-inset-bottom></safe-area-inset-bottom>


		<u-popup v-model="couponShow" border-radius="16" height="900rpx" mode="bottom" safe-area-inset-bottom>
			<view class="coupon-con">
				<view class="coupon-item bg-fff flex" :class="{
		'is-current-item':
			item.user_coupon_id ==
			dataInfo['orderInfo']['orderData']['coupon_id_sys'],
	}" v-for="(item, index) in couponList" :key="index"
					@click="item.user_coupon_id != dataInfo['orderInfo']['orderData']['coupon_id_sys'] ? handleCoupon(item.user_coupon_id) : ''">
					<view class="coupon-item-left flex-center">
						<view v-if="item.coupon_type.value === 20">{{ item.discount }}折</view>
						<view v-else><text class="f24">￥</text>{{ dealWithPrice(item.reduce_price) }}</view>	
						<view class="item-price-tips">
							{{ dealWithText(item) }}
						</view>
					</view>
					<view class="coupon-item-right">
						<view class="flex-space-between" style="padding: 16rpx 14rpx;">
							<view class="">
								<view class="coupon-item-right-name">{{ item.name }}</view>
							</view>
							<u-button type="warning" size='mini' shape="circle"
								v-if="item.user_coupon_id == dataInfo['orderInfo']['orderData']['coupon_id_sys']"
								:disabled='true'>当前选择</u-button>
							<!-- <b-u-button-theme v-if="item.user_coupon_id==dataInfo['orderInfo']['orderData']['coupon_id_sys']" width="144rpx" height="48rpx" size="28rpx"
								>当前选择</b-u-button-theme> -->
							<b-u-button-theme width="110rpx" height="40rpx" size="24rpx" @click.stop="handleCoupon(item.user_coupon_id)" v-else>去使用</b-u-button-theme>
							<!-- <b-u-button-theme v-else width="144rpx" height="48rpx" size="28rpx"
								@click="handleCoupon(item.user_coupon_id)">去使用</b-u-button-theme> -->
						</view>
						<view class="coupon-item-right-time">{{ item.start_time.text }}-{{ item.end_time.text }}</view>
					</view>
				</view>

				<view class="coupon-con-tips" @click="handleCoupon(0)">不使用优惠券</view>
			</view>
		</u-popup>

		<BusinessBox :businessshow="checkbusiness" :businesstxt="businesstxt" :bottom="50"></BusinessBox>
	</view>
</template>

<script>
import {
	mapState
} from 'vuex';
import hTimePicker from "@/components/h-timePicker/h-timePicker.vue";
export default {
	components: {
		hTimePicker
	},
	data() {
		return {
			params: {},
			dataInfo: {},
			address: {},
			remark: "",
			couponShow: false,
			couponList: [],
			order_type: 'buy',
			isWxPay: 0,
			checkbusiness: true,
			businesstxt: '',
			starttime_h: 0,
			starttime_i: 0,
			endtime_h: 0,
			endtime_i: 0,
			yypstime: '',
			getyypstime: 0,
			gift_product_data: null,
			addressDetail: {},
			businessCity: '',
			addressDefault: true,
			jointype: 0,
			real_name: '',
			real_phone: '',
		}
	},
	async onLoad(options) {
		getApp().globalData.addressInfo = {};
		this.order_type = options.order_type;
		console.log('order_type', options)

		if (this.order_type == 'buy') {
			this.params = {
				stall_id: this.vuex_stall_id,
				product_id: options.product_id,
				product_num: options.product_num,
				product_sku_id: options.product_sku_id,
				delivery: 10,
				store_id: 0,
				coupon_id: -1,
				is_use_points: 0,
				pay_source: "wx",
			}
		}

		if (this.order_type == 'cart') {
			this.params = {
				stall_id: this.vuex_stall_id,
				delivery: 10,
				store_id: 0,
				coupon_id: -1,
				is_use_points: 0,
				pay_source: "wx",
				cart_ids: options.cart_ids,
			}
		}

		if (this.order_type == 'seckill') {
			this.params = {
				product_id: options.product_id,
				product_num: options.product_num,
				product_sku_id: options.product_sku_id,
				seckill_product_sku_id: options.seckill_product_sku_id,
				seckill_product_id: options.seckill_product_id,
				delivery: 10,
				store_id: 0,
				coupon_id: 0,
				is_use_points: 0,
				pay_source: "wx",
			}
		}

		if (this.order_type == 'assemble') {
			this.params = {
				product_id: options.product_id,
				product_num: options.product_num,
				product_sku_id: options.product_sku_id,
				assemble_product_sku_id: options.assemble_product_sku_id,
				assemble_product_id: options.assemble_product_id,
				assemble_bill_id: options.assemble_bill_id,
				delivery: 10,
				store_id: 0,
				coupon_id: 0,
				is_use_points: 0,
				pay_source: "wx",
			}
		}

		if (this.order_type == 'activity') {
			this.params = {
				product_id: options.product_id,
				product_num: options.product_num,
				product_sku_id: options.product_sku_id,
				activity_product_sku_id: options.activity_product_sku_id,
				activity_product_id: options.activity_product_id,
				delivery: 10,
				store_id: 0,
				coupon_id: 0,
				is_use_points: 0,
				pay_source: "wx",
			}
		}

		if (this.order_type == 'limited') {
			this.params = {
				stall_id: this.vuex_stall_id,
				product_id: options.product_id,
				product_num: options.product_num,
				product_sku_id: options.product_sku_id,
				delivery: 10,
				store_id: 0,
				coupon_id: 0,
				is_use_points: 0,
				pay_source: "wx",
				discount_product_sku_id: options.discount_product_sku_id,
				discount_product_id: options.discount_product_id,
			}
		}
		if (this.order_type == 'bargain') {
			this.params = {
				product_id: options.product_id,
				product_num: options.product_num,
				product_sku_id: options.product_sku_id,
				bargain_product_sku_id: options.bargain_product_sku_id,
				bargain_product_id: options.bargain_product_id,
				bargain_task_id: options.bargain_task_id,
				delivery: 10,
				store_id: 0,
				coupon_id: 0,
				is_use_points: 0,
				pay_source: "wx",
			}
		}

		this.businessCity = this.maplocation.city

		await this.getCityBusiness();
		this.getAddressDefault()
	},
	computed: {
		...mapState(['vuex_mapid', 'maplocation', 'vuex_stall_id']),
	},
	onShow() {
		if (this.isWxPay == 0) {
			this.getHttp();
		}
		// this.handleSelectAddress();
	},
	onUnload() {
		getApp().globalData.addressInfo = {};
	},
	methods: {
		getAddressDefault() {
			if(this.vuex_stall_id>0){
				this.getAddressDetail_Stall(this.vuex_stall_id)
			}else{
				if (this.addressDefault) {
					this.getAddressDetail(this.vuex_mapid)
				} else {
					this.getAddressDetail(this.address.address_id)
				}
			}
		},
		getAddressDetail(addressid) {
			let self = this;
			uni.$u.api.getAddressDetail({
				address_id: addressid
			}).then(res => {
				self.addressDetail = res.detail
				self.address = self.addressDetail;
				//地址与当前选择地区不同，更新
				if (self.businessCity != res.region[1]) {
					self.businessCity = res.region[1]
					self.changeCity(res.region[0], res.region[1]);
				}
			})
		},
		getAddressDetail_Stall(stall_id) {
			let self = this;
			uni.$u.api.getAddressDetailStall({
				stall_id: stall_id
			}).then(res => {
				self.addressDetail = res.detail
				self.address = self.addressDetail;
				//地址与当前选择地区不同，更新
				if (self.businessCity != res.region[1]) {
					self.businessCity = res.region[1]
					self.changeCity(res.region[0], res.region[1]);
				}
			})
		},
		changeCity(province, city) {
			let self = this;
			uni.$u.api.getCityBusiness({ province: province, city: city }).then(function (res) {
				self.checkbusiness = res.checkbusiness
				self.businesstxt = res.businesstxt
				self.starttime_h = res.make_time_h
				self.starttime_i = res.make_time_i
				self.endtime_h = res.end_t_h
				self.endtime_i = res.end_t_i
			})
		},
		async getCityBusiness() {
			return new Promise((resolve, reject) => {
				let self = this;
				uni.$u.api.getCityBusiness({}).then(async function (res) {
					self.checkbusiness = res.checkbusiness
					self.businesstxt = res.businesstxt
					self.starttime_h = res.make_time_h
					self.starttime_i = res.make_time_i
					self.endtime_h = res.end_t_h
					self.endtime_i = res.end_t_i
					resolve('ok');
				})
			});
		},
		changeTime(strtime, boxtime) {
			this.yypstime = strtime
			this.getyypstime = boxtime
			console.log(this.getyypstime)
		},
		send(type) {
			if(this.vuex_stall_id>0){
				if (uni.$u.test.isEmpty(this.real_name)) {
					uni.showToast({
						title: "请输入联系人或座号",
						icon: "none"
					})
					return;
				}
				if (!uni.$u.test.mobile(this.real_phone)) {
					uni.showToast({
						title: "请填写正确的手机号码",
						icon: "none"
					})
					return
				}
			}else{
				if (uni.$u.test.isEmpty(this.address)) {
					uni.showToast({
						title: "请选择地址",
						icon: "none",
					})
					return;
				}
			}
			let orderbuytype = type
			if (type == 1) {
				if (this.getyypstime <= 0) {
					uni.showToast({
						title: "请选择预约配送时间",
						icon: "none",
					})
					return;
				}
			}

			uni.showLoading({
				title: "加载中...",
				mask: true,
			})

			uni.$u.api.getOrderCheckScope({
				longitude: Number(this.address.longitude),
				latitude: Number(this.address.latitude),
				shop_supplier_id: this.dataInfo.orderInfo.supplierList[0].shop_supplier_id,
			}).then(res => {
				uni.showLoading({
					title: "加载中...",
					mask: true,
				})
				this.storeList = res.storeList;
				if (this.storeList.length > 0) {
					let store_id = this.storeList[0].store_id;
					let shop_supplier_id = this.dataInfo.orderInfo.supplierList[0].shop_supplier_id;
					let params = {
						addr_id: this.address.address_id,
						stall_id: this.vuex_stall_id,
						pay_type: 20,
						room_id: 0,
						coupon_id: this.dataInfo.orderInfo.orderData.coupon_id_sys || 0,
						is_use_points: 0,
						store_id: store_id,
						supplier: {
							[shop_supplier_id]: {
								remark: this.remark,
								delivery: 10,
								store_id: 0,
								coupon_id: 0,
							}
						},
					};
					if(this.vuex_stall_id>0){
						params.real_name = this.real_name;
						params.real_phone = this.real_phone;
					}

					if (this.order_type == 'buy') {
						params.product_id = this.params.product_id;
						params.product_num = this.params.product_num;
						params.product_sku_id = this.params.product_sku_id;
						params.buytype = orderbuytype;
						params.yypstime = this.getyypstime;

						uni.$u.api.postOrderBuy({
							params: JSON.stringify(params)
						}).then(res => {
							this.handlePay(res.order_id[0]);
						})
					}

					if (this.order_type == 'seckill') {
						params.seckill_product_id = this.params.seckill_product_id;
						params.seckill_product_sku_id = this.params.seckill_product_sku_id;
						params.product_num = this.params.product_num;
						params.product_sku_id = this.params.product_sku_id;
						params.buytype = orderbuytype;
						params.yypstime = this.getyypstime;

						uni.$u.api.postOrderSeckill({
							params: JSON.stringify(params)
						}).then(res => {
							this.handlePay(res.order_id[0]);
						})
					}

					if (this.order_type == 'activity') {
						console.log(params, 'activeparams')
						params.activity_product_id = this.params.activity_product_id;
						params.activity_product_sku_id = this.params.activity_product_sku_id;
						params.product_num = this.params.product_num;
						params.product_sku_id = this.params.product_sku_id;
						params.buytype = orderbuytype;
						params.yypstime = this.getyypstime;

						uni.$u.api.postOrderActivity({
							params: JSON.stringify(params)
						}).then(res => {
							this.handlePay(res.order_id[0]);
						})
					}

					if (this.order_type == 'cart') {
						params.cart_ids = this.params.cart_ids;
						params.buytype = orderbuytype;
						params.yypstime = this.getyypstime;

						uni.$u.api.postOrderCartSettle({
							params: JSON.stringify(params)
						}).then(res => {
							this.handlePay(res.order_id[0]);
						})
					}

					if (this.order_type == 'assemble') {
						params.assemble_product_id = this.params.assemble_product_id;
						params.assemble_product_sku_id = this.params.assemble_product_sku_id;
						params.assemble_bill_id = this.params.assemble_bill_id;
						params.product_num = this.params.product_num;
						params.product_sku_id = this.params.product_sku_id;
						params.buytype = orderbuytype;
						params.yypstime = this.getyypstime;

						uni.$u.api.postOrderAssemble({
							params: JSON.stringify(params)
						}).then(res => {
							this.handlePay(res.order_id[0]);
						})
					}
					if (this.order_type == 'limited') {
						params.discount_product_sku_id = this.params.discount_product_sku_id,
							params.discount_product_id = this.params.discount_product_id,
							params.product_num = this.params.product_num;
						params.product_sku_id = this.params.product_sku_id;
						params.buytype = orderbuytype;
						params.yypstime = this.getyypstime;

						uni.$u.api.postDiscountList({
							params: JSON.stringify(params)
						}).then(res => {
							this.handlePay(res.order_id[0]);
						})
					}
					if (this.order_type == 'bargain') {
						params.bargain_task_id = this.params.bargain_task_id,
							params.bargain_product_id = this.params.bargain_product_id,
							params.bargain_product_sku_id = this.params.bargain_product_sku_id;
						params.product_sku_id = this.params.product_sku_id;
						params.buytype = orderbuytype;
						params.yypstime = this.getyypstime;

						uni.$u.api.postBargainList({
							params: JSON.stringify(params)
						}).then(res => {
							this.handlePay(res.order_id[0]);
						})
					}

				} else {
					uni.showToast({
						title: "该地址不在配送范围",
						icon: "none"
					})
				}
			})
		},
		handlePay(order_id) {
			
			// #ifdef H5
			 console.log('h5支付');
				uni.navigateTo({
					'url':'/pages/mine/order/pay_h5?order_type=buy&order_id='+order_id,
				})
			// #endif
			
			// #ifdef MP
			
			
			let self = this;
			uni.$u.api.postPay({
				order_id: order_id,
				pay_source: this.params.pay_source,
				payType: '20',
				use_balance: 0,
			}).then(res => {
				self.jointype = res.is_join
                const url =
					res.is_join == 1
						? '/pages/active/champion/european?order_no=' +
							res.order_no
						: '/pages/mine/order/list?dataType=all';
				uni.showLoading({
					title: "加载中...",
					mask: true,
				})
				this.isWxPay = 1;
				if (res.pay_price > 0) {
					uni.requestPayment({
						provider: "wxpay",
						timeStamp: res.payment.time_stamp,
						nonceStr: res.payment.nonce_str,
						package: res.payment.package,
						signType: res.payment.sign_type,
						paySign: res.payment.pay_sign,
						success(res) {
							uni.showToast({
								title: "支付成功",
							})
							setTimeout(() => {
								if(self.jointype==1){
									uni.reLaunch({
										url
									})
								}else{
									uni.navigateTo({
										url
									})
								}
							}, 1000)
						},
						fail(e) {
							uni.showToast({
								title: "支付失败",
								icon: "none"
							})

							setTimeout(() => {
								uni.navigateTo({
									url: '/pages/mine/order/list?dataType=all'
								})
								// uni.switchTab({
								// 	url: "/pages/mine/mine"
								// })
							}, 1000)
						}
					})
				} else {
					uni.showToast({
						title: "支付成功",
					})
					setTimeout(() => {
						if(self.jointype==1){
							uni.reLaunch({
								url
							})
						}else{
							uni.navigateTo({
								url
							})
						}
					}, 1000)
				}
			})
			// #endif
		},
		handleSelectAddress() {
			if (!uni.$u.test.isEmpty(getApp().globalData.addressInfo)) {
				this.address = getApp().globalData.addressInfo;
				this.addressDefault = false;
				this.getAddressDefault();
			}
		},
		selectAddress() {
			if(this.vuex_stall_id==0){
				uni.navigateTo({
					url: "/pages/mine/address/address?isSelect=1"
				})
			}
		},
		handleCoupon(couponId) {
			this.params.coupon_id = couponId;
			this.getHttp();
			this.couponShow = !this.couponShow;
		},
		dealWithText(item){
            const { min_price, } = item
            if (min_price !== '0.00') {
                const arr = min_price.split('.')
                const text = arr[1] === '00' ? arr[0] : min_price
                return `满${ text }可用`
            } else {
                return '无门槛'
            }
        },
		dealWithPrice(price) {
			const arr = price.split('.')
			const curPriceText = arr[1] === '00' ? arr[0] : price
			return curPriceText
		},
		getOrderBuy() {
			uni.$u.api.getOrderBuy({
				params: this.params
			}).then(res => {
				this.dataInfo = res;
				this.handleSelectAddress();
				this.couponList = [];
				for (let key in this.dataInfo.orderInfo.orderData.coupon_list) {
					this.couponList.push(this.dataInfo.orderInfo.orderData.coupon_list[key]);
				}
			})
		},
		getOrderCartSettle() {
			uni.$u.api.getOrderCartSettle({
				params: this.params
			}).then(res => {
				this.dataInfo = res;
				this.handleSelectAddress();
				this.couponList = [];
				for (let key in this.dataInfo.orderInfo.orderData.coupon_list) {
					this.couponList.push(this.dataInfo.orderInfo.orderData.coupon_list[key]);
				}
			})
		},
		getOrderSeckill() {
			console.log('进入页面getOrderSeckill', this.params)
			uni.$u.api.getOrderSeckill({
				params: this.params
			}).then(res => {
				this.dataInfo = res;
				this.handleSelectAddress();
			})
		},
		getOrderActivity() {
			uni.$u.api.getOrderActivity({
				params: this.params
			}).then(res => {
				this.dataInfo = res;
				this.handleSelectAddress();
				this.couponList = [];
				for (let key in this.dataInfo.orderInfo.orderData.coupon_list) {
					this.couponList.push(this.dataInfo.orderInfo.orderData.coupon_list[key]);
				}
			})
		},
		getOrderAssemble() {
			uni.$u.api.getOrderAssemble({
				params: this.params
			}).then(res => {
				this.dataInfo = res;
				this.handleSelectAddress();
			})
		},
		getDiscountList() {
			console.log('进入页面getOrderSeckill', this.params)
			uni.$u.api.getDiscountList({
				params: this.params
			}).then(res => {
				this.dataInfo = res;
				this.gift_product_data = this.dataInfo.orderInfo.gift_product_data ? this.dataInfo.orderInfo.gift_product_data : null
				this.handleSelectAddress();
			})
		},
		getBargainList() {
			console.log('进入页面getOrderBargain', this.params);
			uni.$u.api.getBargainList({
				params: this.params
			}).then(res => {
				this.dataInfo = res;
				this.handleSelectAddress();
			})
		},
		getHttp() {
			// uni.showLoading({
			// 	title: '加载中...',
			// 	mask: true
			// })
			if (this.order_type == 'buy') {
				this.getOrderBuy();
			}
			if (this.order_type == 'cart') {
				this.getOrderCartSettle();
			}
			if (this.order_type == 'seckill') {
				this.getOrderSeckill();
			}
			if (this.order_type == 'activity') {
				this.getOrderActivity();
			}
			if (this.order_type == 'assemble') {
				this.getOrderAssemble();
			}
			if (this.order_type == 'limited') {
				this.getDiscountList()
			}
			if (this.order_type == 'bargain') {
				this.getBargainList()
			}
			// setTimeout(() => {
			// 	uni.hideLoading();
			// }, 800)
		},
	},
}
</script>

<style lang="scss" scoped>
.container {
	background: linear-gradient(180deg, #BB0024 0%, #F6F6F6 276rpx);
	padding: 30rpx;

	.address {
		border-radius: 16rpx;
		padding: 26rpx 34rpx;

		.address-title {
			font-size: 32rpx;
			color: #111111;
		}

		.address-info {
			margin-top: 28rpx;
			border-top: 1px solid rgba(225, 225, 225, 0.7);
			padding-top: 28rpx;

			.address-info-text {
				font-size: 32rpx;
				color: #111111;
				font-weight: bold;
			}

			.address-info-user {
				margin-top: 28rpx;
				font-size: 28rpx;
				color: #333333;
			}
		}
	}

	.flex-box {
		display: flex;
		flex-direction: row;
		justify-content: space-between;

		.changeTime {
			font-size: 28rpx;
			color: #333333;
		}

		&.bor-top {
			margin-top: 20rpx;
			;
		}
	}

	.product {
		padding: 26rpx 34rpx;
		border-radius: 16rpx;
		margin-top: 20rpx;

		.product-item-gift {
			margin: 10rpx 0;
			padding: 20rpx;
			background: rgba(225, 225, 225, 0.7);
			border-radius: 20rpx;
		}

		.product-item {
			margin-bottom: 24rpx;

			.product-item-image {
				width: 128rpx;
				height: 128rpx;
			}

			.product-item-con {
				margin-left: 16rpx;
				flex: 1;

				.product-item-name {
					width: 460rpx;
					font-size: 28rpx;
					color: #111111;
				}

				.product-item-suk {
					font-size: 24rpx;
					color: #999999;
				}

				.product-item-num {
					font-size: 24rpx;
					color: #999999;
				}

				.product-item-price {
					font-size: 28rpx;
					color: $uni-color-theme;
				}
			}
		}

		.product-total {
			border-top: 1px solid rgba(225, 225, 225, 0.7);
			padding-top: 24rpx;
			text-align: right;

			text {
				font-weight: bold;
				font-size: 32rpx;
			}
		}
	}

	.pay {
		border-radius: 16rpx;
		margin-top: 20rpx;
		padding: 32rpx 34rpx;
		font-size: 28rpx;
		color: #111111;
	}

	.cell {
		margin-top: 20rpx;
		padding: 0 34rpx;
		border-radius: 16rpx;

		.cell-item {
			padding: 28rpx 0;
		}

		.cell-item+.cell-item {
			border-top: 1px solid rgba(225, 225, 225, 0.7);
		}
	}

	.settle {
		margin-top: 20rpx;
		border-radius: 160rpx;
		background: linear-gradient(90deg, #383838 0%, #5A5A5A 100%);
		color: #ffffff;
		padding-left: 30rpx;

		.settle-image {
			width: 40rpx;
			height: 40rpx;
		}

		.settle-total {
			border-left: 1px solid #ffffff;
			padding-left: 20rpx;
			margin-left: 20rpx;
		}
	}

	.coupon-con {
		padding: 30rpx;
		background: #F6F6F6;

		.coupon-item {
			border-radius: 16rpx;
			height: 168rpx;
			margin-bottom: 24rpx;
			.coupon-item-right {
				flex: 1;

				.coupon-item-right-price {
					font-size: 24rpx;
					color: #bb0024;
				}

				
			}
		}

		.coupon-con-tips {
			font-size: 28rpx;
			color: #666666;
			text-align: center;
			padding: 40rpx 0;
			background-color: #fff;
			border-radius: 16rpx;
		}
	}

	/deep/.u-drawer-content {
		background-color: #F6F6F6 !important;
	}
	
	.warning-price{
		margin-top: 20rpx;
		// padding: 0 40rpx;
		
		.warning-txt{
			display: flex;
			flex-direction: row;
			align-items: center;
			justify-content: flex-end;
			padding: 16rpx 30rpx;
			border-radius: 8rpx;
			transition: all 0.3s linear;
			background: #fce0c8;
			color: #2e2f31;
			font-size: 24rpx;
			.warning{
				margin-left: 5rpx;
				margin-right: 5rpx;
				font-size: 26rpx;
				color: #000;
				font-weight: bold;
			}
		}
	}
	
}
.coupon-item-left {
	width: 218rpx;
	font-size: 40rpx;
	color: #bb0024;
	border-right: 1px dashed rgba(232, 13, 13, 0.3);
	flex-direction: column;
	font-weight: bold;
	// padding: 0 30rpx;

}
.coupon-item-right-name {
	// font-size: 28rpx;
	// color: #bb0024;
	font-weight: bold;
}
.coupon-item-right-time {
	border-top: 1px dashed rgba(232, 13, 13, 0.3);
	font-size: 24rpx;
	color: #666666;
	padding: 15rpx 30rpx 0rpx;
}
.coupon-item-right-price-text {
	color: #666666;
}
.is-current-item {
	background-color: #fcbd7136;
}
.f24 {
	font-size: 24rpx;
}
.item-price-tips {
	margin-top: 10rpx;
	font-size: 24rpx;
	color: $uni-color-theme;
	text-align: center;
	padding: 0px 6rpx 0px 8rpx;
	font-weight: normal;
}
</style>